home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 7 / PCPP #7.iso / utils / vis-irc / vscript.txt < prev   
Encoding:
Text File  |  1996-09-08  |  45.5 KB  |  1,340 lines

  1. ViRCScript Documentation (for Visual IRC '96 0.60 and above) - Revision 10
  2. ==========================================================================
  3.  
  4. Introduction
  5. ============
  6.  
  7. What is ViRCScript? ViRCScript (from now on abbreviated to VS) is the scripting
  8. language supported by ViRC '96. VS is similar to BASIC, C, VPL, and ircII's
  9. scripting language. You use VS to write code for events and aliases. In 0.60,
  10. the ViRCScript interpreter is around 90% complete. Newer versions will add more
  11. functionality, however, I will endeavour to ensure that these new changes don't
  12. break your old code.
  13.  
  14. VS is 100% written by myself. I've used no code from anywhere else or custom
  15. controls in my parser, numerical evaluator, or anything else. This means that
  16. if you have any problems, you have no-one to blame them on but me. >:-> (That
  17. said, no-one has reported any real problems in ViRCScript. It seems to be the
  18. most stable portion of V96 I've written so far).
  19.  
  20. What's new in this release of ViRCScript?
  21. -----------------------------------------
  22.  
  23. Except the ++ (increment) and -- (decrement) operators and performance
  24. improvements, there's little new in this release of ViRCScript. However, much
  25. functionality that existed in previous releases wasn't properly documented
  26. here, so I've tried to remedy that now, making sure that every function in
  27. V96's internal function table is documented.
  28.  
  29. Syntax
  30. ------
  31.  
  32. Place one VS instruction on each line. Lines beginning with # or // are assumed
  33. to be comments, and are ignored. Otherwise the line is parsed and executed.
  34. Statements and functions are case-insensitive, except for variables, which are
  35. case-sensitive, i.e. $x is not the same as $X. Numerical parameters to
  36. functions can be supplied in decimal, or in hex by prefixing with a $. For
  37. example, to get a random number between 0 and 254, you could use:
  38.  
  39.         $rand(255)
  40.  
  41.     Or:
  42.  
  43.         $rand($FF)
  44.  
  45. Variables
  46. ---------
  47.  
  48. Variables are allocated and assigned with the @ operator, and deallocated with
  49. the -@ operator. Examples:
  50.  
  51.         @ $x = Hello everybody!!
  52.         -@ $x
  53.  
  54. Wildcards are supported when using -@, and this is very useful with arrays.
  55. Say, for example, you defined the following array:
  56.  
  57.         @ $greeting.0 = Hello
  58.         @ $greeting.1 = Hi
  59.         @ $greeting.2 = Yo
  60.         @ $greeting.3 = Greetings
  61.         @ $greeting.4 = Howdy
  62.  
  63. You could delete the whole thing in one go with the single statement:
  64.  
  65.         -@ $greeting.*
  66.  
  67. Or, as the array element numbers are only 1 figure long:
  68.  
  69.         -@ $greeting.?
  70.  
  71. You should always deallocate used variables at the end of your scripts, as
  72. "dangling" variables will make script parsing slower and take up memory.
  73.  
  74. In addition, ViRC '96 0.34 and above support stored variables. These are like
  75. regular variables, except their values are stored in the registry, and hence
  76. are retained if V96 is closed down and then restarted. Define a stored
  77. variable exactly like a regular variable, except use @s instead of @. Undefine
  78. a stored variable by using -@s instead of -@. For example:
  79.  
  80.         @s $script_ver = YTooLZ for ViRC '96 version 4.91
  81.  
  82. The value of $script_ver will not be lost when V96 is closed down.
  83.  
  84. You can evaluate a numeric expression by enclosing it in $( and ). For example:
  85.  
  86.         @ $x = $(1+1)
  87.  
  88. You can evaluate expressions as complex as you want, including variables and
  89. functions, for example:
  90.  
  91.         @ $x = $((((16/2)*$strpos(xt $3-))+(18/$dfactor))-1)
  92.  
  93. $() is not required in if/while/for statements, as the conditions are evaluated
  94. numerically anyway.
  95.  
  96. In addition, V96 0.60 and above support the C-style ++ and -- operators. What's
  97. more, they're not just a pretty face - they execute a LOT, LOT faster than the
  98. equivalent code @ $i = $($i + 1), and are ideal for loops and things. For
  99. example, to increment $x by one, you could use:
  100.  
  101.         $x++
  102.  
  103. Please not that you DO NOT prefix this with an @, like with other variable
  104. assignments!!
  105.  
  106. Pseudovariables (Pvars) are also supported in aliases and events. A typical
  107. Pvar looks like $0, or $7-, and represents a parameter supplied to the alias or
  108. event. $n means the n'th parameter. With events, the first word of the line of
  109. text received from the server is $0, the second word $1, and so on. With
  110. aliases, the alias command is $0, the first parameter supplied is $1, the
  111. second parameter supplied is $2, and so on. In addition, an expression like
  112. $2- means "the second parameter and all subsequent parameters". So, $2- is
  113. equal to $2 $3 $4 $5 $6 $7 $8 .... $n. More about this later.
  114.  
  115. V96 also maintains a number of built-in variables. These are as follows:
  116.  
  117.         $ver    The current version of V96, e.g. 0.60
  118.         $build  The current version V96 in integer form, e.g. 60
  119.         $N      Your nickname
  120.         $U      Your username
  121.         $H      Your hostname
  122.         $ip     Your IP address
  123.         $server The server you're connected to
  124.         $C      The channel the user types the event in. If the event
  125.                 is typed in a server window, $C is set to . (a period).
  126.         $null   Equals nothing. Use to set variables to nothing, e.g.
  127.                 @ $x = $null
  128.  
  129. A number of constants are also maintained:
  130.  
  131.         \b      Bold
  132.         \u      Underline
  133.         \i      Italic
  134.         \A      ASCII character 1 -  (used for CTCPs)
  135.  
  136. Note that V96 supports a number of simultaneous server connections, even if
  137. you're on the same channel on both servers!! And you can have a different
  138. nickname on each server. So what nickname does $N correspond to? The answer is,
  139. the active context's nickname. If you use $N from an event, $N is the nickname
  140. on the server which caused the event. $N in an alias refers to the nickname of
  141. the current server connection relating to the window you typed the alias in.
  142. For example, $N in a channel window would be your nick on the server that
  143. you're on that channel on. Sounds confusing? Just use $N and it should work as
  144. you expect it to every time. =]
  145.  
  146. What about $+ you may ask. As most of you know, in mIRC, PIRCH etc. you need
  147. $+ to trim spaces ... in other words, you'd need something like this:
  148.  
  149.         *** $nick ( $+ $user $+ @ $+ $host $+ ) has joined channel $3
  150.  
  151. To display this:
  152.  
  153.         *** MeGALiTH (megalith@jimc.demon.co.uk) has joined channel #quake
  154.  
  155. In V96, spaces are not required before variables and functions, because of its
  156. intelligent parser. So you could do something like this, which looks much
  157. neater:
  158.  
  159.         *** $nick ($user@$host) has joined channel $3
  160.  
  161. The above would totally foul up mIRC and PIRCH. In fact, V96 doesn't care what
  162. you have before or after a variable. This would work:
  163.  
  164.         alkjdsjkadjka$nickjhdakajsdakjdhkjadhk
  165.  
  166. So, the skeptic asks, in this case, how does V96 know whether you want the
  167. variable $nick, $nickj, $nickjhdak, or what? The answer is, it reads your mind.
  168. Well, no, it doesn't - it actually sorts the variables alphabetically and
  169. parses them in reverse order (you what?!??!). This ends up with the right
  170. result. If a variable $nickjhd exists, then it'll parse the line as containing
  171. $nickjhd, otherwise it'll do $nickjh, and if that doesn't exist, $nickj ... and
  172. so on, all the way down to $n. So, again, as with the multiple-$N-on-multiple-
  173. servers thing I described above, V96 is intelligent enough to work out what
  174. you're trying to do, and do it correctly.
  175.  
  176. ViRCScript Statements
  177. =====================
  178.  
  179. TEXTOUT statement
  180. -----------------
  181.  
  182. Usage: TextOut [> window] <colour> <text ...>
  183.  
  184. Displays some text in a window. If the window name is left out, TextOut will
  185. output the text to all channel windows, unless there are none open, in which
  186. case the text will be displayed in the server window. Specifying a channel name
  187. will display the text in that channel (or the server window if the channel
  188. doesn't exist). Specifying . will output the text to the server notices window.
  189. Specifying anything else will create a query window with that name (if it
  190. doesn't already exist) and output the text there. You can use a query window
  191. created "on-the-fly" like this as a simple text output window for your scripts.
  192.  
  193. Colour may be specified in four ways.
  194.  
  195.         (1) Specifying a colour constant. The following colour constants
  196.             are supported (this will be familiar to Delphi 2.0 users):
  197.  
  198.             clBlack             Black
  199.             clMaroon            Maroon
  200.             clGreen             Green
  201.             clOlive             Olive green
  202.             clNavy              Navy blue
  203.             clPurple            Purple
  204.             clTeal              Teal
  205.             clGray              Gray
  206.             clSilver            Silver
  207.             clRed               Red
  208.             clLime              Lime green
  209.             clBlue              Blue
  210.             clFuchsia           Fuchsia
  211.             clAqua              Aqua
  212.             clWhite             White
  213.  
  214.             clBackground        Current color of your Windows background
  215.             clActiveCaption     Current color of the title bar of the active window
  216.             clInactiveCaption   Current color of the title bar of inactive windows
  217.             clMenu              Current background color of menus
  218.             clWindow            Current background color of windows
  219.             clWindowFrame       Current color of window frames
  220.             clMenuText          Current color of text on menus
  221.             clWindowText        Current color of text in windows
  222.             clCaptionText       Current color of the text on the title bar of the active window
  223.             clActiveBorder      Current border color of the active window
  224.             clInactiveBorder    Current border color of inactive windows
  225.             clAppWorkSpace      Current color of the application workspace
  226.             clHighlight         Current background color of selected text
  227.             clHightlightText    Current color of selected text
  228.             clBtnFace           Current color of a button face
  229.             clBtnShadow         Current color of a shadow cast by a button
  230.             clGrayText          Current color of text that is dimmed
  231.             clBtnText           Current color of text on a button
  232.             clInactiveCaptionText   Current color of the text on the title bar of an inactive window
  233.             clBtnHighlight      Current color of the highlighting on a button
  234.             cl3DDkShadow        Windows 95 only: Dark shadow for three-dimensional display elements
  235.             cl3DLight           Windows 95 only: Light color for three-dimensional display elements (for edges facing the light source)
  236.             clInfoText          Windows 95 only: Text color for tooltip controls
  237.             clInfoBk            Windows 95 only: Background color for tooltip controls
  238.  
  239.             The second half of the colors listed here are Windows system
  240.             colors. The color that appears depends on the color scheme users
  241.             are using for Windows. Users can change these colors using the
  242.             Control Panel in Program Manager. The actual color that appears
  243.             will vary from system to system. For example, the color fuchsia
  244.             may appear more blue on one system than another.
  245.  
  246.             For example, to output some blue text in the server window:
  247.  
  248.                 TextOut > . clBlue blah blah blah ...
  249.  
  250.         (2) Specifying an event colour constant. Event colour constants
  251.             correspond to the colour of the corresponding event type the user
  252.             has selected in Client setup/Colours and fonts. This allows scripts
  253.             that you write to automatically adjust to the colours the user
  254.             wants. The following event colour constants are available.
  255.  
  256.             ecJOIN              Join colour
  257.             ecPART              Part colour
  258.             ecQUIT              Quit colour
  259.             ecTOPIC             Topic change colour
  260.             ecMODE              Mode change colour
  261.             ecKICK              Kick colour
  262.             ecPRIVMSG           Private message colour
  263.             ecNOTICE            Notice colour
  264.             ecCTCP              CTCP colour
  265.             ecACTION            Action colour
  266.             ecNICK              Nick change colour
  267.             ecMyChanText        Colour of channel text the user has entered himself
  268.             ecChanText          Colour of channel text other users have entered
  269.             ecMyQueryText       Colour of query text the user has entered himself
  270.             ecQueryText         Colour of query text other users have entered
  271.             ecServText          Colour of server text
  272.             ecError             Colour of error text
  273.             ecScript or ecXDCC  Colour of script (e.g. XDCC) status messages
  274.  
  275.             For example:
  276.  
  277.                 TextOut ecKICK This text will appear in the same colour as channel kicks do.
  278.  
  279.         (3) Specifying a hex RGB value, in the form $bbggrr.
  280.  
  281.  
  282.             For example:
  283.  
  284.                 TextOut $0000FF This text is red.
  285.                 TextOut $00FF00 This text is green.
  286.                 TextOut $FF0000 This text is blue.
  287.                 TextOut $00FFFF This text is yellow.
  288.                 TextOut $FFFFFF This text is white.
  289.                 TextOut $000000 This text is black.
  290.  
  291.         (4) Specifying a decimal RGB value. This is rather useless, unless
  292.             you're specifying the text colour as a random number, e.g.
  293.  
  294.                 TextOut $rand($FFFFFF) This text appears in a random colour.
  295.  
  296. IF/ELSE/ENDIF statements
  297. ------------------------
  298.  
  299. Usage: if (condition)
  300.           ...
  301.        [else]
  302.           [...]
  303.        endif
  304.  
  305. Executes a block of code only if a given condition is true. Multiple conditions
  306. can be specified, and are separated with && (boolean AND) or || (boolean OR)
  307. operators. If the condition is false and an ELSE block exists, this code is
  308. executed. The following operators are supported:
  309.  
  310.         Op  | Meaning
  311.       ------+--------------------------
  312.         ==  | Equal to
  313.         !=  | Not equal to
  314.         >   | Greater than
  315.         <   | Less than
  316.         >=  | Greater than or equal to
  317.         <=  | Less than or equal to
  318.         +   | Plus
  319.         -   | Minus
  320.         *   | Multiply
  321.         /   | Divide
  322.         ^^  | Power
  323.         &&  | Boolean AND
  324.         ||  | Boolean OR
  325.         !   | Boolean NOT
  326.  
  327. If you're used to C, you'll have no problems. Expressions can be as simple or
  328. as complex as you like - you can nest many levels of brackets if you need to.
  329.  
  330. IF can be used to compare numeric expressions or string expressions. All string
  331. expressions must be enclosed in []'s, just as in ircII.
  332.  
  333. Numeric expression example:
  334.  
  335.         if (2+3 == 5)
  336.            TextOut clBlue Of course it does!!
  337.         endif
  338.  
  339. String expression example:
  340.  
  341.         if ([hello] == [goodbye])
  342.            TextOut clBlue Not unless the laws of physics have changed.
  343.         endif
  344.  
  345. Boolean operators may also be used. && = and, || = or, ! = not.
  346.  
  347.         if (2+3 == 5) && (4*2 == 8)
  348.            TextOut clBlue Naturally.
  349.         endif
  350.  
  351. In fact, you'll rarely have to use the ! operator. You'll see that the
  352. following two statements are equivalent:
  353.  
  354.         if ([$x] != [$y])
  355.         if !([$x] == [$y])
  356.  
  357. Note that spaces are not required (they are ignored by the parser), but may be
  358. included for clarity. For example:
  359.  
  360.         if (2+3==5)&&(10*17==170)&&((5>=2)||(9=16))
  361.  
  362. That's perfectly correct, but impossible to read ;). Adding spaces makes the
  363. statement far clearer:
  364.  
  365.         if (2+3 == 5) && (10*17 == 170) && ((5 >= 2) || (9 == 16))
  366.  
  367. You must enclose string expressions in []'s. This prevents V96 from trying to
  368. numerically evaluate the text between the [ and the ]. For example:
  369.  
  370.         if ([$nick] == [hello])
  371.            TextOut clBlue Blah!!
  372.         endif
  373.  
  374. An ELSE construction is supported too.
  375.  
  376.         @ $x = $?="What does IRC stand for?"
  377.         if ([$x] == [Internet Relay Chat])
  378.            TextOut clGreen Well done!!
  379.         else
  380.            TextOut clRed Wrong!!
  381.         endif
  382.  
  383. WHILE/ENDWHILE statements
  384. -------------------------
  385.  
  386. Usage: while (condition)
  387.          ...
  388.        endwhile
  389.  
  390. Executes a block of code while condition is true. If condition is false
  391. initially, the while block will be skipped. See the IF/ELSE/ENDIF statement for
  392. details on how to specify conditions. Beware, as a condition that's always true
  393. will produce an infinite loop and will lock V96 up!! For example:
  394.  
  395.         while (1)
  396.         endwhile
  397.  
  398. In fact, now ViRCScript has a C-like for statement, while is largely
  399. superflous. In fact:
  400.  
  401.         while (condition)
  402.           ...
  403.         endwhile
  404.  
  405. Is functionally-identical to:
  406.  
  407.         for (;condition;)
  408.           ...
  409.         endfor
  410.  
  411. The for statement is used only with a condition, with no initial statement and
  412. no increment statement.
  413.  
  414. FOR/ENDFOR statements
  415. ---------------------
  416.  
  417. Usage: for (initial statement;condition;increment statement)
  418.          ...
  419.        endfor
  420.  
  421. V96's for statement behaves exactly like the for statement in C/C++, so you
  422. should have no problems. For example, the following C code:
  423.  
  424.         for (int i = 0; i < 10; i++)
  425.           printf("%d", i);
  426.  
  427. Is equivalent to the following ViRCScript code:
  428.  
  429.         for (@ $i = 0; $i < 10; $i++)
  430.           TextOut clBlue $i
  431.         endfor
  432.  
  433. (Note the use of the new ++ operator here!!)
  434.  
  435. Note that variables created by the for statement (e.g. the $i above) are not
  436. deallocated at the end, so the following statement should really be added to
  437. the end of the above code fragment:
  438.  
  439.         -@ $i
  440.  
  441. The for and while statements are often interchangable. In fact:
  442.  
  443.         for (x;y;z)
  444.           ...
  445.         endfor
  446.  
  447. Is equivalent to:
  448.  
  449.         x
  450.         while (y)
  451.           ...
  452.           z
  453.         endwhile
  454.  
  455. However, usage of for is much neater in many cases than while. Note that, just
  456. like C, misuse of for can lock the system up!! Compare the following C
  457. fragment:
  458.  
  459.         for (;;)
  460.           ...
  461.  
  462. And the following ViRCScript:
  463.  
  464.         for (;;)
  465.           ...
  466.         endfor
  467.  
  468. Both will lock the system up in an infinite loop. So be careful!!
  469.  
  470. ALIAS/ENDALIAS statements
  471. -------------------------
  472.  
  473. Usage: alias <name> [hotkey]
  474.          ...
  475.        endalias
  476.  
  477. Defines an alias (similar to a procedure or function in other languages).
  478. The parameters of the alias are passed in as $1, $2, $3 and so on, and the
  479. actual alias command itself is passed in as $0. The channel window the alias is
  480. typed in is passed in as $C. $C is set to . if the alias is run from the server
  481. notices window. Optionally, hotkey may be specifed (e.g. F3, or Ctrl+Shift+Z).
  482. When hotkey is pressed, the alias will be executed as if it were typed in the
  483. current window.
  484.  
  485. Aliases can be very useful, for example, consider this:
  486.  
  487.         Alias GO
  488.           Connect
  489.           Join #quake
  490.           Msg Bot !op
  491.           Mode #quake +ooo User1 User2 User3
  492.           Part #quake
  493.           Quit
  494.         EndAlias
  495.  
  496. When the user types /go, V96 will connect to the server, join #quake, /msg Bot
  497. for ops, op User1, User2 and User3, leave #quake, and quit IRC. Aliases can
  498. also be used as functions. Simply assign a value to $fresult as the value of
  499. the function. For example, consider this, a function to pick and return a
  500. random boolean value, either True or False:
  501.  
  502.         Alias RANDBOOL
  503.           @ $x = $rand(2)
  504.           if ($x == 1)
  505.              @ $fresult = True
  506.           else
  507.              @ $fresult = False
  508.           endif
  509.         EndAlias
  510.  
  511. Now:
  512.  
  513.         TextOut clBlue Random boolean expression: $randbool()
  514.  
  515. Another use for aliases is executing frequently-used single commands. For
  516. example, say you're on #quake, and are frequently asked what the current
  517. version of Quake is. You could make an alias like this:
  518.  
  519.         Alias QUAKEVER
  520.           Say $C $1: The current version of Quake is 1.01.
  521.         EndAlias
  522.  
  523. Then, for example, if Dnormlguy asked what the latest version of Quake was,
  524. in the #quake channel window, you could just type /quakever Dnormlguy. V96
  525. would expand $C to #quake, and $1 to the first parameter, Dnormlguy. So, the
  526. text "Dnormlguy: The current version of Quake is 0.92" to the channel.
  527.  
  528. EVENT/ENDEVENT statements
  529. -------------------------
  530.  
  531. Usage: event <name> <priority> "<mask>"
  532.          ...
  533.        endevent
  534.  
  535. Defines an event. Events are the most powerful feature of VS, although also the
  536. hardest to grasp. The best way to get a feel for events is to look through
  537. V96's built-in events and see how they work.
  538.  
  539. Name is just an arbitrary name to assign to the event. You can call events
  540. anything you like. Mask is the text that must be received from the server to
  541. trigger the event, and can include wildcards. Priority is the event priority,
  542. which confuses many people.
  543.  
  544. Parameters are passed into the event with the first word received from the
  545. server as $0, the second word as $1, etc. In addition, the sender of the
  546. message's nick is stored in $nick, the username in $user, and the hostname
  547. in $host. If the message originates from the server, $nick is the server, and
  548. $user and $host are empty. Example:
  549.  
  550.         :greygoon!bhess@wilma.widomaker.com NOTICE MeGALiTH :You're not opped!!
  551.  
  552. This is what the server sends when greygoon sends the notice
  553. "You're not opped!!" to MeGALiTH. So, the parameter breakdown would be as
  554. follows:
  555.  
  556.         $0      :greygoon!bhess@wilma.widomaker.com
  557.         $1      NOTICE
  558.         $2      MeGALiTH
  559.         $3      :You're
  560.         $4      not
  561.         $5      opped!!
  562.  
  563.         $nick   greygoon
  564.         $user   bhess
  565.         $host   wilma.widomaker.com
  566.  
  567. Thus the activation mask for a NOTICE is "* NOTICE *". This basically means:
  568. $0 can be anything, $1 must be NOTICE, and $2 can be anything. Any parameters
  569. that are not supplied can be anything - in fact, the * at the end of the mask
  570. is not really necessary, but is included for clarity.
  571.  
  572. Now for how priorities work ... basically, V96 will execute a maximum of ONE
  573. event handler for every ONE line of server text. If two events are defined,
  574. both of whose masks match the server text, V96 will execute the event with the
  575. higher priority. For example, consider this. V96 comes with two events, one for
  576. handling private messages, and one for handling channel messages. Look at the
  577. handlers for each.
  578.  
  579.         Private messages:
  580.  
  581.            Event PrivateMessage 4 "* PRIVMSG *"
  582.  
  583.         Channel messages:
  584.  
  585.            Event ChannelMessage 5 "* PRIVMSG #*"
  586.  
  587. A typical private message received from the server may look like this:
  588.  
  589.         :nick!user@host PRIVMSG YourNick :hello!!
  590.  
  591. A typical channel message might look like this:
  592.  
  593.         :nick!user@host PRIVMSG #quake :hello all!!
  594.  
  595. Now, remember that V96 will only execute one event per line of server text. If
  596. the server receives a line of private text, the only event that applies is
  597. the PrivateMessage event. The ChannelMessage event's third parameter must begin
  598. with # for the event to be fired, and this is not the case with a private
  599. message. So the priority is ignored, because only one event is possible.
  600. The correct selection of priority is _required_ when two events are defined,
  601. and one line of server text can match both events: if a CHANNEL message is
  602. received, you can see that both events apply. A channel message's mask matches
  603. both * PRIVMSG * and * PRIVMSG #*. So, V96 will see that this line of server
  604. text matches two events, and will execute the event with the highest priority.
  605. I realize that priority may be a tricky concept, but hopefully you'll get the
  606. hang of it in no time. ;)
  607.  
  608. Note that the <default> event (mask *), which is fired for every line of server
  609. text that is received, has a priority of 0. This means that the event is only
  610. executed if NO OTHER EVENTS match the line of server text, because all other
  611. events have a priority higher than 0.
  612.  
  613. PARSE/ENDPARSE statements
  614. -------------------------
  615.  
  616. Usage: parse text
  617.         ...
  618.        endparse
  619.  
  620. Parses text into the pseudovariables $0 to $9 for the duration of the parse
  621. block. Without doubt one of the most powerful commands in ViRCScript. Its use
  622. is best illustrated by an example:
  623.  
  624.         @ $x = This is a test.
  625.         Parse $x
  626.           TextOut clBlue $0 $1 $2 $3
  627.           TextOut clBlue $3 $2 $1 $0
  628.         EndParse
  629.  
  630. The following will appear on the screen:
  631.  
  632.         This is a test.
  633.         test. a is This
  634.  
  635. The values of the pseudovariables are restored to their previous state at the
  636. end of the parse block. So, they are only valid between Parse and EndParse.
  637. You must assign them to other variables if you want to use them outside the
  638. parse block. You may nest as many parse blocks within each other as you like.
  639.  
  640. What in reality could this be used for? One idea is a #chaos-type question
  641. game, You have a file called QUESTION.TXT which contains questions and answers
  642. in the form:
  643.  
  644.         answer question ...
  645.         answer question ...
  646.         answer question ...
  647.  
  648. And so on. You want some code to pick a random question from the file, putting
  649. the question in $question and the answer in $answer. The following code would
  650. do the trick:
  651.  
  652.         @ $x = $randomread(question.txt)
  653.         Parse $x
  654.           @ $answer = $0
  655.           @ $question = $1-
  656.         EndParse
  657.  
  658. MENUTREE/ENDMENUTREE command
  659. ----------------------------
  660.  
  661. Usage: menutree menutype
  662.          [item1]
  663.          [item2]
  664.          ...
  665.        endmenutree
  666.  
  667. Defines the menu tree for menutype. This command is used to define the
  668. structure of a menu or popup, before code is assigned to each item. The
  669. following values for menutype are currently recognized:
  670.  
  671.      MT_MAINMENU     - define the tree for the main menu
  672.      MT_SERVERPOPUP  - define the tree for the server window popup
  673.      MT_CHANNELTEXT  - define the tree for the channel window text pane popup
  674.      MT_CHANNELNICKS - define the tree for the channel window names pane popup
  675.  
  676. Each item defined between MenuTree and EndMenuTree takes the following format:
  677.  
  678.      ItemName HotKey State Depth Text
  679.  
  680. ItemName is an arbitrary name to give to the menu item. The name will be used
  681. again later to define the code when you click on the menu item. HotKey defines
  682. what hotkey to activate the menu item on. HotKey can be something like F12 or
  683. Ctrl+Shift+A, or <none> if you don't require a hotkey. Note that HotKey is
  684. ignored for menus other than MT_MAINMENU. State determines the menu item's
  685. state. For menu types MT_MAINMENU and MT_SERVERPOPUP, State can take the
  686. following values:
  687.  
  688.         0 - Menu item is enabled
  689.         1 - Menu item is enabled when you're connected to the server, and
  690.             disabled otherwise
  691.         2 - Menu item is disabled when you're connected to the server, and
  692.             enabled otherwise
  693.         3 - Menu item is disabled
  694.  
  695. For menu types MT_CHANNELTEXT and MT_CHANNELNICKS, State can take the following
  696. values:
  697.  
  698.         0 - Menu item is enabled
  699.         1 - Menu item is enabled when you're opped on this channel, and
  700.             disabled otherwise
  701.         2 - Menu item is disabled when you're opped on this channel, and
  702.             enabled otherwise
  703.         3 - Menu item is disabled
  704.  
  705. Depth defines the "depth" of the menu item. For MT_MAINMENU, a depth of 0
  706. represents an entry on the top menu bar. A depth of 1 is a subitem of the
  707. closest item above which has a depth of 0. A depth of 2 is a subitem of the
  708. closest item above that has a depth of 1.
  709.  
  710. Text is the actual text to display on the menu. If an & is present in Text,
  711. you can pull the menu down quickly by pressing Alt and the letter after the &.
  712.  
  713. Here are some example menu tree items, taken from DEFAULT.LIB:
  714.  
  715.   M_FILE       <none> 0 0 &File
  716.   M_NEWCONNECT Ctrl+K 0 1 &New connection ...
  717.   M_SETUP      <none> 0 1 Client s&etup ...
  718.   M_FSEP1      <none> 0 1 -
  719.   M_EXIT       Alt+X  0 1 E&xit
  720.   M_TOOLS      <none> 0 0 &Tools
  721.   M_FINGER     Ctrl+F 0 1 UNIX &finger ...
  722.  
  723. Hopefully by comparing this with what you actually see in the program will
  724. enable you to understand the significance of each field.
  725.  
  726. MENUITEM/ENDMENUITEM command
  727. ----------------------------
  728.  
  729. Usage: menuitem ItemName on MenuType
  730.  
  731. Defines the ViRCScript code to trigger when the user clicks on the menu item
  732. Name on the menu type MenuType. MenuType can take the same values here as with
  733. the MenuTree command detailed above. In the above example, one of the item
  734. lines between MenuTree and EndMenuTree is:
  735.  
  736.   M_NEWCONNECT Ctrl+K 0 1 &New connection ...
  737.  
  738. To define the ViRCScript code to actually make this open a new server window,
  739. you would use:
  740.  
  741.         MenuItem M_NEWCONNECT on MT_MAINMENU
  742.           NewServerWindow
  743.         EndMenuItem
  744.  
  745. For a good example of how this works, see DEFAULT.LIB.
  746.  
  747. Menu items on a MenuType of MT_CHANNELNICKSPOPUP are supplied with the nickname
  748. selected in the names pane of the currently-active channel window as the
  749. parameter $1. For example:
  750.  
  751.         MenuItem M_HELLO on MT_CHANNELNICKSPOPUP
  752.           Say $C Hello, $1!!
  753.         EndMenuItem
  754.  
  755. If the user clicks on abc123's nick in a channel window, and then right-clicks
  756. and selects M_HELLO from the popup menu, the text "Hello, abc123!!" will be
  757. said to the channel.
  758.  
  759. UPDATEMENUS command
  760. -------------------
  761.  
  762. Usage: updatemenus
  763.  
  764. Recreates all menus and popups from the in-memory menu trees and writes the
  765. trees to the registry. After you have changed menu(s) with MenuTree and
  766. MenuItem statements, you must use this command for your changes to take effect
  767. properly. Failure to execute this command when you've finished altering the
  768. menus can cause unwanted side-effects, as the in-memory menu trees and the
  769. actual menus and popups become desynchronized from each other.
  770.  
  771. NAME statement
  772. --------------
  773.  
  774. Usage: name text
  775.  
  776. Names your script text. This isn't really a statement at all. It's used by the
  777. script loader to display your script's name in the loading progress dialog box.
  778. It's recommended you use NAME to give your script a sensible name at the top of
  779. the file, so people know what they're loading.
  780.  
  781. MESSAGEBOX command
  782. ------------------
  783.  
  784. Usage: MessageBox text
  785.  
  786. Displays a message box on the screen with an OK button, with text as its
  787. contents. Use this in scripts to inform the user of something.
  788.  
  789. CREATEFILE command
  790. ------------------
  791.  
  792. Usage: CreateFile filename
  793.  
  794. Creates filename, or truncates it to 0 bytes if it already exists.
  795.  
  796. APPENDTEXT command
  797. ------------------
  798.  
  799. Usage: AppendText filename text
  800.  
  801. Appends text to the end of filename. The command will do nothing if filename
  802. does not exist.
  803.  
  804. SETINPUTLINE command
  805. --------------------
  806.  
  807. Usage: SetInputLine channel text
  808.  
  809. Sets the command entry box's contents of channel to text. If you wish to set
  810. the contents of the server window's entry box, specify . as channel (a period).
  811.  
  812. EVAL command
  813. ------------
  814.  
  815. Usage: Eval command
  816.  
  817. Normally, commands are evaluated before executing them. Placing EVAL before a
  818. command line causes the line to be evaluated twice before executing. You'd
  819. probably never have to use this in your scripts, except when evaluating
  820. expressions that are stored somewhere else, for example, a line in a file.
  821. To get a random line from a file, evaluate that line, and store in $x, you'd
  822. use:
  823.  
  824.         Eval @ $x = $randomread(filename.txt)
  825.  
  826. BREAK command
  827. -------------
  828.  
  829. Usage: Break
  830.  
  831. Quits from the currently-executing code block. A code block is something like
  832. the code between if/endif, while/endwhile, parse/endparse etc. If this
  833. statement is executed outside a code block, execution of your script routine
  834. will stop (see the HALT command).
  835.  
  836. HALT command
  837. ------------
  838.  
  839. Usage: Halt
  840.  
  841. Similar to the BREAK command, only exits from ALL code blocks and terminates
  842. execution of your script.
  843.  
  844. FALLTHROUGH command
  845. -------------------
  846.  
  847. Usage: FallThrough
  848.  
  849. This powerful command makes event programming much easier. If you've defined a
  850. special event, but you only want it to execute sometimes, and the rest of the
  851. time you want the system to behave as if the event was never defined, you can
  852. use the FallThrough statement to pass the event down to a handler of lower
  853. priority. A good example is if you're writing, for example, a channel
  854. statistics script, which catches WHO replies (* 352 *) and processes them,
  855. without displaying them in the server notices window. However, if the user has
  856. not typed /chanst, then the regular <default> event should be executed to
  857. display the WHO on the screen in the normal way. The event would be defined
  858. like this:
  859.  
  860. Event ChanStatWHOReply 5 "* 352 *"
  861.   if ($doingchanst)
  862.      ...
  863.   else
  864.      FallThrough
  865.   endif
  866.  
  867. YIELD command
  868. -------------
  869.  
  870. Usage: Yield
  871.  
  872. Polls the Windows message queue and processes waiting messages. If you're
  873. writing a script that uses a while loop that takes a long time to execute, it
  874. may be a good idea to use YIELD to prevent the system from locking up while
  875. your script is executing. For example, the following will lock V96 up:
  876.  
  877.         while (1)
  878.         endwhile
  879.  
  880. However, the following will not lock V96 up, although it'll slow it down a
  881. little because it is actually executing the while loop over and over again,
  882. ad infinitum:
  883.  
  884.         while (1)
  885.           Yield
  886.         endwhile
  887.  
  888. The YIELD command is very useful when implementing background processing.
  889. Adding a YIELD statement to a time-consuming for loop will allow other tasks to
  890. continue running in the background while the for loop executes.
  891.  
  892. IRC commands
  893. ------------
  894.  
  895. Usage: [^][*]command ...
  896.  
  897. Regular IRC commands may be used in VS (of course ;), only the slash prefix is
  898. optional and should be left out, and the code looks neater without it. In
  899. addition, the command can be prefixed with ^, * or ^*.
  900.  
  901. A prefix of ^ surpresses the output of any text that the command directly
  902. causes. For example, V96 contains code in its MSG command to display the
  903. message you're sending on the screen. ^MSG will send the message, but surpress
  904. the next output.
  905.  
  906. A prefix of * passes the command straight into V96's built-in command
  907. interpreter, without executing any aliases. This is very useful if you're
  908. trying to override built-in commands, as, for example, if you want to call
  909. V96's MSG command in your new MSG alias, you need to call the command as *MSG
  910. to avoid the alias calling itself recursively.
  911.  
  912. Both prefixes can be combined as ^*. Please note that a prefix of *^ is
  913. INVALID, and will cause an error.
  914.  
  915. The following code will change the text displayed when the user uses the /msg
  916. command to something a little more fancy, demonstrating how to override a
  917. built-in command:
  918.  
  919. Alias MSG
  920.   TextOut ecPRIVMSG [*>\b$1\b<*]\t$2-
  921.   ^*Msg $1-
  922. EndAlias
  923.  
  924. ViRCScript Functions
  925. ====================
  926.  
  927. Currently, only a few functions are implemented, however, many more functions
  928. will be implemented in future versions.
  929.  
  930. Getting input from the user
  931. ---------------------------
  932.  
  933. $? pseudofunction
  934. -----------------
  935.  
  936. Usage: $?="prompt"
  937.  
  938. Prompts the user to enter some text, displaying prompt in the text entry dialog
  939. box. This is similar to mIRC's $? "function".
  940.  
  941. STRTRIM function
  942. ----------------
  943.  
  944. Usage: $strtrim(text)
  945.  
  946. Removes control characters and the preceding colon, if present, from text. This
  947. is very useful, as many lines received from the IRC server contain parameters
  948. prefixed by a colon.
  949.  
  950. Example: Consider this line of server text.
  951.  
  952.         :nick!user@host PRIVMSG #channel :well, what's up everybody!!
  953.  
  954. To extract the actual message sent to the channel correctly, you would use
  955. $strtrim($3-).
  956.  
  957. DECODEPINGINTERVAL function
  958. ---------------------------
  959.  
  960. Usage: $decodepinginterval(integer)
  961.  
  962. Converts the ping-encoded integer specified to a human-readable time interval.
  963. This function is only useful to decode received pings. To decode normal time
  964. intervals, use the DECODEINTERVAL function.
  965.  
  966. DECODEINTERVAL function
  967. -----------------------
  968.  
  969. Usage: $decodeinterval(integer)
  970.  
  971. Converts the integer supplied as the parameter to a human-readable time
  972. interval. For example:
  973.  
  974.         $decodeinterval(38) = 38 seconds
  975.         $decodeinterval(60) = 1 minute
  976.         $decodeinterval(61) = 1 minute 1 second
  977.         $decodeinterval(3728) = 1 hour 2 minutes 8 seconds
  978.  
  979. UPPER function
  980. --------------
  981.  
  982. Usage: $upper(text)
  983.  
  984. Converts the given text to upper case. For example:
  985.  
  986.         $upper(blah) = BLAH
  987.  
  988. LOWER function
  989. --------------
  990.  
  991. Usage: $lower(text)
  992.  
  993. Converts the given text to lower case. For example:
  994.  
  995.         $lower(BLAH) = blah
  996.  
  997. STRPOS function
  998. ---------------
  999.  
  1000. Usage: $strpos(needle haystack)
  1001.  
  1002. Finds needle within haystack, and returns the character position of needle.
  1003. 0 is returned if needle is not found in haystack. For example:
  1004.  
  1005.         $strpos(cd abcdefg) = 3
  1006.         $strpos(blah hahahahha) = 0
  1007.  
  1008. RAND function
  1009. -------------
  1010.  
  1011. Usage: $rand(n)
  1012.  
  1013. Returns a random integer in the range 0 to n - 1. For example, $rand(1000) may
  1014. return 0, 273, or 879, but never -112 or 1000.
  1015.  
  1016. RANDOMREAD function
  1017. -------------------
  1018.  
  1019. Usage: $randomread(file)
  1020.  
  1021. Returns a randomly-selected line from file. This is useful for quote or slap
  1022. scripts.
  1023.  
  1024. ISON function
  1025. -------------
  1026.  
  1027. Usage: $ison(nick channel)
  1028.  
  1029. Returns true (1) if nick is on channel, otherwise returns false (0). Example:
  1030.  
  1031.         if $ison(MeGALiTH #quake)
  1032.            Msg MeGALiTH Hi there!!
  1033.         endif
  1034.  
  1035. ISOP function
  1036. -------------
  1037.  
  1038. Usage: $isop(nick channel)
  1039.  
  1040. Returns true (1) if nick is an op on channel. If nick is a non-op on channel,
  1041. or if nick is not on channel, returns false (0).
  1042.  
  1043. WILDMATCH function
  1044. ------------------
  1045.  
  1046. Usage: $wildmatch(text mask)
  1047.  
  1048. Matches text against mask, which can contain wildcards. Examples:
  1049.  
  1050.         $wildmatch(blah *lah) = 1
  1051.         $wildmatch(blah bla*) = 1
  1052.         $wildmatch(blah *la*) = 1
  1053.         $wildmatch(blah *) = 1
  1054.         $wildmatch(blah *hah) = 0
  1055.  
  1056. Mask comparisons are case-insensitive. text may contain spaces. mask, however,
  1057. may not.
  1058.  
  1059. MASKMATCH function
  1060. ------------------
  1061.  
  1062. Usage: $maskmatch(text mask)
  1063.  
  1064. Matches text against mask. Use MASKMATCH, and _not_ WILDMATCH, if you're trying
  1065. to match a nick!user@host-style mask. Example:
  1066.  
  1067.         $maskmatch(MeGALiTH!~megalith@jimc.demon.co.uk *!*megalith@*demon.co.uk) = 1
  1068.  
  1069. Mask comparisons are case-insensitive.
  1070.  
  1071. NICKCOUNT function
  1072. ------------------
  1073.  
  1074. Usage: $nickcount(channel)
  1075.  
  1076. Returns the number of users on channel. If channel doesn't exist, the function
  1077. will return 0.
  1078.  
  1079. OPCOUNT function
  1080. ----------------
  1081.  
  1082. Usage: $opcount(channel)
  1083.  
  1084. Returns the number of ops on channel. If channel doesn't exist, or if there are
  1085. no ops, the function will return 0.
  1086.  
  1087. PEONCOUNT function
  1088. ------------------
  1089.  
  1090. Usage: $peoncount(channel)
  1091.  
  1092. Returns the number of peons (non-ops) on channel. If channel doesn't exist, or
  1093. if there are no peons, the function will return 0.
  1094.  
  1095. NICKS function
  1096. --------------
  1097.  
  1098. Usage: $nicks(channel num)
  1099.  
  1100. Returns the num'th user on channel. For example, $nicks(#quake 45) will return
  1101. the nick of the 45th user on channel #quake (the list is sorted
  1102. alphabetically, with ops at the top, followed by peons). If channel doesn't
  1103. exist, or there is no user at num (i.e. if num is less than 1 or greater than
  1104. $nickcount), the function will return nothing.
  1105.  
  1106. OPS function
  1107. ------------
  1108.  
  1109. Usage: $ops(channel num)
  1110.  
  1111. Returns the num'th op on channel. For example, $ops(#quake 3) will return the
  1112. nick of the 3rd op on channel #quake (the list is sorted alphabetically). If
  1113. channel doesn't exist, or there is no op at num (i.e. if num is less than 1 or
  1114. greater than $opcount), the function will return nothing.
  1115.  
  1116. PEONS function
  1117. --------------
  1118.  
  1119. Usage: $peons(channel num)
  1120.  
  1121. Returns the num'th peon (non-op) on channel. For example, $peons(#quake 19)
  1122. will return the nick of the 19th peon on channel #quake (the list is sorted
  1123. alphabetically). If channel doesn't exist, or there is no peon at num (i.e. if
  1124. num is less than 1 or greater than $peoncount), the function will return
  1125. nothing.
  1126.  
  1127. FILEEXISTS function
  1128. -------------------
  1129.  
  1130. Usage: $fileexists(filename)
  1131.  
  1132. Returns true (1) if filename exists, otherwise returns false (0).
  1133.  
  1134. SUBSTR function
  1135. ---------------
  1136.  
  1137. Usage: $substr(text start num)
  1138.  
  1139. Returns num characters at start from text. Exactly equivalent to Delphi's
  1140. Copy(text, start, num) function or VB's Mid$(text, start, num) function.
  1141. Example:
  1142.  
  1143.         $substr(abcdef 2 3) = bcd
  1144.  
  1145. GETINPUTLINE function
  1146. ---------------------
  1147.  
  1148. Usage: $getinputline(channel)
  1149.  
  1150. Gets the current contents of the command entry box in channel. To do this for
  1151. the server notices window, specify . as channel (a period).
  1152.  
  1153. LENGTH function
  1154. ---------------
  1155.  
  1156. Usage: $length(text)
  1157.  
  1158. Returns the length of text in characters. Example:
  1159.  
  1160.         $length(hello) = 5
  1161.  
  1162. CHANNELCOUNT function
  1163. ---------------------
  1164.  
  1165. Usage: $channelcount()
  1166.  
  1167. Returns the number of open channels.
  1168.  
  1169. CHANNELS function
  1170. -----------------
  1171.  
  1172. Usage: $channels(num)
  1173.  
  1174. Returns the name of open channel number num. For example, if you have one
  1175. channel open, #quake, $channels(1) will return #quake. If the channel number
  1176. num specified does not exist, the function will return nothing.
  1177.  
  1178. GETSETTING function
  1179. -------------------
  1180.  
  1181. Usage: $getsetting(section value)
  1182.  
  1183. This is a very powerful function which allows a script to obtain any ViRC '96
  1184. user setting that it's stored in the registry. For example, the default event
  1185. library that comes with V96, DEFAULT.LIB, uses this function to determine
  1186. whether to output text in a query window or not, depending on whether the user
  1187. has chosen to use a query window or not in the Options tab of the Client Setup
  1188. dialog.
  1189.  
  1190. The best way to find the values for section and value is to load up REGEDIT (it
  1191. comes with Windows 95 and NT) and to look in
  1192. HKEY_CURRENT_USER/Software/MeGALiTH Software/Visual IRC '96. All available
  1193. sections are visible there.
  1194.  
  1195. Examples:
  1196.  
  1197.         $getsetting(Options QueryEnabled)
  1198.         $getsetting(Options AutoRejoin)
  1199.         $getsetting(SOCKS setup Enabled)
  1200.         $getsetting(IDENTD setup Port)
  1201.  
  1202. GETUSERLEVEL function
  1203. ---------------------
  1204.  
  1205. Usage: $getuserlevel(mask)
  1206.  
  1207. Returns the userlevel of mask in your userlist. For example, if
  1208. *!*blah@*hah.com is in your userlist with level 3,
  1209. $getuserlevel(user!nablah@spahah.com) would return 3. If the user cannot be
  1210. found in the userlist, the function will return 0.
  1211.  
  1212. GETBANLEVEL function
  1213. ---------------------
  1214.  
  1215. Usage: $getbanlevel(mask)
  1216.  
  1217. Returns the banlevel of mask in your banlist. If the user cannot be found in
  1218. the banlist, the function will return 0.
  1219.  
  1220. GETPROTLEVEL function
  1221. ---------------------
  1222.  
  1223. Usage: $getprotlevel(mask)
  1224.  
  1225. Returns the protlevel of mask in your protlist. If the user cannot be found in
  1226. the protlist, the function will return 0.
  1227.  
  1228. TIME function
  1229. -------------
  1230.  
  1231. Usage: $time()
  1232.  
  1233. Returns the current system time in a human-readable format (hh:mm:ss xx). For
  1234. example, $time() may return 11:52:48 AM.
  1235.  
  1236. DATE function
  1237. -------------
  1238.  
  1239. Usage: $date()
  1240.  
  1241. Returns the current system date in default system format. This format is
  1242. determined by your Windows locale (internationalization) settings, and may be
  1243. something like 17th June 1996.
  1244.  
  1245. CTIME function
  1246. --------------
  1247.  
  1248. Usage: $ctime()
  1249.  
  1250. Used to calculate time intervals, measured in seconds. The actual value
  1251. returned is the number of seconds that Windows has been running, although this
  1252. may change in the future and cannot be relied upon. The number returned by
  1253. $ctime() increases by 1 every second. For example:
  1254.  
  1255.         @ $x = $ctime()
  1256.         for (@ $i = 0; $i < 1000; @ $i = $($i + 1))
  1257.           Yield
  1258.         endfor
  1259.         TextOut clBlue *** An empty 1000-iteration for loop takes $($ctime() - $x) seconds to complete.
  1260.  
  1261. Notice how $ctime() is used here to calculate a time interval - the actual
  1262. meaning of the value returned by $ctime() is insignificant.
  1263.  
  1264. The $ctime() function can also be used as a timer. For example, to wait for
  1265. 20 seconds before quitting V96, you could use the following code:
  1266.  
  1267.         @ $x = $ctime()
  1268.         while ($ctime() - $x) < 20
  1269.           Yield
  1270.         endwhile
  1271.         Exit
  1272.  
  1273. MTIME function
  1274. --------------
  1275.  
  1276. Usage: $mtime()
  1277.  
  1278. Used to calculate time intervals, measured in milliseconds. Use for measuring
  1279. time intervals. The number returned by $mtime() increases by 1 every
  1280. millisecond.
  1281.  
  1282. IDLETIME function
  1283. -----------------
  1284.  
  1285. Usage: $idletime()
  1286.  
  1287. Returns the amount of time the user has been idle for in seconds. Can be used
  1288. to implement auto-away scripts. For example, the following code will wait until
  1289. the user has been idle for 2 minutes (120 seconds) and will then set him away:
  1290.  
  1291.         while ($idletime < 120)
  1292.           Yield
  1293.         endwhile
  1294.         Away Automatically set away after 2 minutes
  1295.  
  1296. IDLEMTIME function
  1297. ------------------
  1298.  
  1299. Usage: $idlemtime()
  1300.  
  1301. Returns the amount of time the user has been idle for in milliseconds. The same
  1302. as $idletime(), only returns a value in milliseconds rather than seconds.
  1303.  
  1304. CURRENTCHANNEL function
  1305. -----------------------
  1306.  
  1307. Usage: $currentchannel()
  1308.  
  1309. Returns the name of the channel window that currently has the focus. If a
  1310. channel window does not have the focus, this function will return . (a period).
  1311. Note that, in an alias, $C and $currentchannel() are equivalent, however, in an
  1312. event, $currentchannel() returns the correct value, whereas $C is undefined.
  1313. Useful if you want to write some text to the channel window the user currently
  1314. has the focus set to (so he/she won't miss the text!!).
  1315.  
  1316. ISQUERYING function
  1317. -------------------
  1318.  
  1319. Usage: $isquerying(nick)
  1320.  
  1321. Returns 1 if a query window is currently open for nick, and 0 otherwise.
  1322.  
  1323. ASC function
  1324. ------------
  1325.  
  1326. Usage: $asc(char)
  1327.  
  1328. Returns the ASCII value for char. For example, $asc(A) = 65, as the ASCII code
  1329. for the character A is 65.
  1330.  
  1331. CHAR function
  1332. -------------
  1333.  
  1334. Usage: $char(value)
  1335.  
  1336. Returns the character for value. For example, $asc(65) = A, as the character
  1337. A corresponds to the ASCII code 65.
  1338.  
  1339.  
  1340.